﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
using MyATM.Entity;

namespace MyATM.DataAccess
{
    public class BankOfficerDA
    {
        /// <summary>
        /// Xac thuc nhan vien tren he thong.
        /// </summary>
        /// <param name="userId">Ma nhan vien</param>
        /// <param name="userPass">Mat khau truy cap</param>
        /// <returns>true - success</returns>
        public bool AuthenticateOfficer(string userId, string userPass)
        {
            string cmd =
                string.Format(
                    "SELECT 1 AS Expr1 FROM BankOfficer WHERE (((BankOfficer.[EmpID])=\"{0}\") AND ((BankOfficer.[Password])=\"{1}\"));",
                    userId, userPass);
            int tempResult = SqlAccess.ExcuteQuery(cmd).Rows.Count;
            if (tempResult == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
